<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <!-- 引用模板 Header -->
    <div th:insert="bg/publicHead :: publicHead(${pageName})"></div>
    <!-- [ Header ] end -->

    <style type="text/css">
        .inputStyle{ padding:0px !important; }
        i{ cursor:pointer; }
        .red{ color:#FF3535; font-weight:700; }
        .blue{color:#0000ff; font-weight:700;}
        .img{width:50px; height:50px;}
        .Export{ display:flex; justify-content:flex-start; align-items:center; }
        .Export div{ margin-right:10px; }
    </style>
    <script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/js/stroage.js" type="text/javascript" charset="UTF-8"></script>
    <script src="/js/comm.js" type="text/javascript" charset="UTF-8"></script>
    <script th:inline="javascript">
        window.onerror=function(){return true;};
        var reg=/^1((34[0-8]\d{7})|((3[0-3|5-9])|(4[5-7|9])|(5[0-3|5-9])|(66)|(7[2-3|5-8])|(8[0-9])|(9[1|8|9]))\d{8})$/
        var ServerIP=[(${ServerIP!=null?'"'+ServerIP+'"':'"'+'"'})];
        $(document).ready(function() {
                $(".funBtn").click(async function(){
                    var dataid=$(this).attr("id");
                    var that=$(this);
                    var orderstatus=$(this).parents(".trClass").find(".orderstatus")
                    var phone=$(this).parents(".trClass").find(".phone");
                    var wname=$(this).parents(".trClass").find(".wname");
                    var wno=$(this).parents(".trClass").find(".wno");
                    if(/\S/.test(wname.val())===false){
                        alert("请输入物流公司名称");
                        wname.focus();
                        return;
                    }
                    /*if(/\S/.test(wno.val())===false){
                        alert("请输入运单号");
                        wno.focus();
                        return;
                    }*/
                    /*alert(beizhu.val());
                    return;*/
                    if (confirm("是否提交?")) {
                        //alert(dataid+","+cardAccount+","+cardPwd);
                        updateData={
                            id:dataid,
                            adrphone:phone.text(),
                            wlname:wname.val(),
                            wlcode:wno.val(),
                        };
                        if(updateData!=null){
                            var res=await SyncJson("/api/updateOrders",updateData);
                            if(res.code===200){
                                if(/\S/.test(wno.val())===true) {
                                    orderstatus.text("已发货");
                                    orderstatus.css("color","#0000ff");
                                }
                                alert("更新成功");
                            }
                        }
                    }
            });


            /*if(myStorage.getItem("startDate")!=null){
                $(".startDate").val(myStorage.getItem("startDate"));
            }
            if(myStorage.getItem("endDate")!=null){
                $(".endDate").val(myStorage.getItem("endDate"));
            }

            $(".selectData").click(function(){
                var startDate=$(".startDate").val();
                var endDate=$(".endDate").val();
                if(/\S/.test(startDate)===false){
                    alert("请输入开始日期");
                    $(".startDate").focus();
                    return;
                }
                if(/\S/.test(endDate)===false){
                    alert("请输入结束日期");
                    $(".startDate").focus();
                    return;
                }
                myStorage.setItem("startDate",startDate);
                myStorage.setItem("endDate",endDate);
                window.location.href="/bg/oilorder/"+startDate+"/"+endDate;
            });

            $(".exportData").click(function(){
                var startDate=$(".startDate").val();
                var endDate=$(".endDate").val();
                if(/\S/.test(startDate)===false){
                    alert("请输入开始日期");
                    $(".startDate").focus();
                    return;
                }
                if(/\S/.test(endDate)===false){
                    alert("请输入结束日期");
                    $(".startDate").focus();
                    return;
                }
                window.location.href="/bg/api/downLoadExcel/"+startDate+"/"+endDate;
            });*/



        });
    </script>
</head>


<body class="background-img-7">

<!-- [ navigation menu ] start -->
<!-- 引用模板 Header -->
<div th:insert="bg/templateLeft :: Menu(${pageName})"></div>
<!-- [ navigation menu ] end -->


<!-- [ Header ] start -->
<!-- 引用模板 Header -->
<div th:insert="bg/templateTop :: Header"></div>
<!-- [ Header ] end -->


<!-- [ Main Content ] start -->
<div class="pcoded-main-container"> <!--中间 Start -->

    <div class="pcoded-content">

        <!-- [ homePage ] start -->
        <!-- 引用模板 homePage -->
        <div th:insert="bg/homePage :: homePage"></div>
        <!-- [ homePage ] end -->


        <!-- [ Main Content ] start -->
        <!-- [ 内容区域 ] start -->
        <div class="row">
            <!-- 课程列表 -->

            <div class="col-xl-12 mainCotent">
                <h5><text th:text="${pageName}"></text></h5>
                <div><a href="/bg/order">刷新</a></div>
                <!-- json源码 -->
                <!--<div th:text="${imageesData}"></div>-->
                <!--
                <div class="Export">
                    <div><input class="startDate" type="text" placeholder="开始日期 2023-02-25" value=""></div>
                    <div><input class="endDate" type="text" placeholder="结束日期 2023-02-27" value=""></div>
                    <div><input class="selectData" type="button" value="查询"></div>
                    <div><input class="exportData" type="button" value="导出Excel"></div>
                </div> Export End -->
                <!-- Latest Order start -->
                <div class="col-md-12">
                    <div class="card table-card latest-activity-card" style="margin-top:20px;">

                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-hover table-borderless">
                                    <!-- dt-responsive table-responsive -->
                                    <!--<table id="res-config" class="display table table-striped table-hover dt-responsive nowrap" style="width:100%">-->
                                    <thead>
                                    <tr>
                                        <th width="130px"><div align="center">日期</div></th>
                                        <th width="120px"><div align="center">订单号</div></th>
                                        <th width="120px"><div align="center">收货人</div></th>
                                        <th width="130px"><div align="center">手机号</div></th>
                                        <th width="60px"><div align="center">收货地址</div></th>
                                        <th width="100px"><div align="center">支付金额</div></th>
                                        <th width="100px"><div align="center">订单状态</div></th>
                                        <th width="80px"><div align="center">发货状态</div></th>
                                        <th width="60px"><div align="center">物流公司</div></th>
                                        <th width="60px"><div align="center">运单号</div></th>
                                        <th width="80px"><div align="center">操作</div></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr class="trClass" th:if="${unifiedOrders!=null}"  th:each="item:${unifiedOrders}">
                                        <td style="width:130px;"><div align="center" th:text="${item.createtime}"></div></td>
                                        <td style="width:120px;"><div align="center" th:text="${item.orderno}"></div></td>
                                        <td style="width:120px;"><div align="center" th:text="${item.adrname}"></div></td>
                                        <td style="width:130px;"><div align="center" class="phone" th:text="${item.adrphone}"></div></td>
                                        <td style="width:60px;"><div align="center" style="width:200px;overflow: hidden;"><input type="text" style="width:200px" th:value="${item.adradress}+''+${item.adrdetail}"></div></td>
                                        <td style="width:100px;"><div align="center" th:text="${item.totalpay}+'元'"></div></td>
                                        <td style="width:100px;"><div align="center" th:text="${item.paystatue}" style="color:#00a100;"></div></td>
                                        <td style="width:80px;"><div align="center" class="orderstatus" th:text="${item.deliverstatue}" th:style="${item.deliverstatue=='未发货'?'color:#ff2525':'color:#0000ff'}"></div></td>
                                        <td style="width:60px;"><div align="center"><input style="width:80px;" type="text" class="wname" th:value="${item.wlname!=null?item.wlname:''}"> </div></td>
                                        <td style="width:60px;"><div align="center"><input style="width:100px;" type="text" class="wno" th:value="${item.wlcode!=null?item.wlcode:''}"></div></td>
                                        <td style="width:80px;">
                                            <div align="center">
                                                <a th:id="${item.id}" title="发货" class="funBtn"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Latest Order end -->
            </div>
        </div> <!-- [ Main Content ] end -->

    </div>

</div> <!--中间 End -->


<!-- 引用模板 Bottom -->
<div th:insert="bg/publicBottom :: publicBottom"></div>
<!-- [ Bottom ] end -->



<script src="/js/sweetalert.min.js"></script>

</body>



</html>